package com.example.kotlin.config

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
import org.mybatis.spring.annotation.MapperScan
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
@MapperScan("com.example.kotlin.mapper")
class MybatisPlusConfig {

    /**
     * 配置mybatis-plus的分页插件
     */
    @Bean
    fun paginationInterceptor(): PaginationInterceptor {
        val paginationInterceptor = PaginationInterceptor()
        // 设置最大单页数量限制，默认500条，-1不受限制
        paginationInterceptor.setLimit(500)
        // 设置请求的页面大于最大页后操作， true调回到首页，false 继续请求  默认false
        paginationInterceptor.setOverflow(false)
        return paginationInterceptor;
    }


}